package com.practice.springboot.jpa.service;

import com.practice.springboot.jpa.dao.BookDao;
import com.practice.springboot.jpa.model.Book;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author sai
 * @create 2020-08-23 4:55
 */
@Service
public class BookService {

    @Autowired
    private BookDao bookDao ;

    public List<Book> getBooksByAuthorStartingWith(String author){
        return bookDao.getBooksByAuthorStartingWith(author) ;
    }

    public Book getMaxIdBook( ){
        return bookDao.getMaxIdBook() ;
    }

    public List<Book> getBookByIdAndAuthor(String author, Long id ){
        return bookDao.getBookByIdAndAuthor(author,id) ;
    }

    public List<Book> getBookByIdnAndName(Long id ,String name ){
        return bookDao.getBookByIdnAndName(name,id ) ;
    }

}
